<?php
class Excption1{
    protected $msg;
    public function make(int $len){
        return $this->code($len);
    }

    protected function code(int $len){
        if($len > 5){
            $this->msg = '验证码长度太长';
            return false;
        }
        #继续做其他操作
    }

    public function getErrorMsg(){
        return $this->msg;
    }
}

$e = new Excption1();
$e->make(5);
echo $e->getErrorMsg();